package org.apache.flink.connector.elasticsearch.sink;

import co.elastic.clients.elasticsearch.core.bulk.BulkOperationVariant;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

import java.io.IOException;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;

/** A single stream element which contains a BulkOperationVariant. */
public class Operation implements Serializable {
    private static final long serialVersionUID = 1L;

    private final List<BulkOperationVariant> bulkOperationVariant;

    public Operation(List<BulkOperationVariant> bulkOperations) {
        this.bulkOperationVariant = bulkOperations;
    }

    public List<BulkOperationVariant> getBulkOperationVariant() {
        return bulkOperationVariant;
    }

    @Override
    public int hashCode() {
        return Objects.hash(bulkOperationVariant);
    }

    @Override
    public String toString() {
        return "Operation{" + "bulkOperationVariant=" + bulkOperationVariant + '}';
    }
}
